// const base = window.__POWERED_BY_QIANKUN__ ? "/containerReact" : '/'; // 此处对应主应用注册子应用的activeRule
// const routes = [
//     {
//         path: '/',
//         component: () => import('../views/demoA.js')
//     },
// ]
// const exportRoutes = routes.map(item => {
//     return {
//         path: base + item.path,
//         component: asyncComponent(item.component) //asyncComponent 处理异步加载组件
//     }
// })

import React, { lazy, Suspense } from 'react';
// import { Layout } from "antd"
import { useRoutes } from 'react-router-dom';

// import DemoA from '../views/demoA';
// import DemoB from '../views/demoB';

// import styles from "./index.module.css"

// const { Header, Content, Footer } = Layout
// const Home = lazy(() => import(/* webpackChunkName: "Home" */ "../views/home"));
const LayoutView = lazy(() => import(/* webpackChunkName: "Layout" */ "../views/Layout"));
// 使用React的lazy函数动态导入组件
const DemoA = lazy(() => import(/* webpackChunkName: "DemoA" */ "../views/demoA"));
const DemoB = lazy(() => import(/* webpackChunkName: "DemoB" */ "../views/demoB"));
const NotFound = () => <h1>404</h1>
const routes = [
    {
        path: '/main',
        element: <LayoutView />,
        children: [
            {
                index: true,
                path: 'demoA',
                element: <DemoA />
            },
            {
                path: 'demoB',
                element: <DemoB />
            }
        ]
    },
    {
        path: '*',
        element: <NotFound />
    }
]
function WrapperRoutes() {
    let element = useRoutes(routes) // 识别当前的url， 返回对应的组件
    return element
}
export default WrapperRoutes
